﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using yq.IBase;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using cn.Util;
using yq.IBase.Basis;

namespace yq.Model.Logic
{
    ///<summary>
    /// Sys_File - 文件表 - 对象继承类
    /// </summary>
    [Table("Sys_File")]
    [MetadataType(typeof(SysFileValidaTion))]
    public class SysFile : ModelBase<SysFile>
    {

        /// <summary>
        /// 为本对象赋值
        /// </summary>
        /// <param name="dy"></param>
        public override void SetValue(dynamic dy)
        {
            this.FileId = dy.FileId;
            this.Sid = dy.Sid;
            this.FolderId = dy.FolderId;
            this.FileName = dy.FileName;
            this.Extension = dy.Extension;
            this.FileSize = dy.FileSize;
            this.UpTime = dy.UpTime;
            this.IsDel = dy.IsDel;
            this.Version = dy.Version;
        } 

        /// <summary>
        /// 文件ID
        /// </summary>
        private String _FileId = "";


        ///<summary>
        /// 文件ID
        ///</summary>
        [FromDb("FileId", true)]
        public String FileId
        {
            get
            {
                return (this._FileId);
            }

            set
            {
                _FileId = value;
            }
        }







        /// <summary>
        /// 服务ID
        /// </summary>
        private String _Sid = "";


        ///<summary>
        /// 服务ID
        ///</summary>
        [FromDb("Sid")]
        public String Sid
        {
            get
            {
                return (this._Sid);
            }

            set
            {
                _Sid = value;
            }
        }







        /// <summary>
        /// 文件夹ID
        /// </summary>
        private String _FolderId = "";


        ///<summary>
        /// 文件夹ID
        ///</summary>
        [FromDb("FolderId")]
        public String FolderId
        {
            get
            {
                return (this._FolderId);
            }

            set
            {
                _FolderId = value;
            }
        }







        /// <summary>
        /// 文件名称
        /// </summary>
        private String _FileName = "";


        ///<summary>
        /// 文件名称
        ///</summary>
        [FromDb("FileName")]
        public String FileName
        {
            get
            {
                return (this._FileName);
            }

            set
            {
                _FileName = value;
            }
        }







        /// <summary>
        /// 文件扩展名
        /// </summary>
        private String _Extension = "";


        ///<summary>
        /// 文件扩展名
        ///</summary>
        [FromDb("Extension")]
        public String Extension
        {
            get
            {
                return (this._Extension);
            }

            set
            {
                _Extension = value;
            }
        }







        /// <summary>
        /// 文件大小
        /// </summary>
        private int _FileSize = int.MinValue;


        ///<summary>
        /// 文件大小
        ///</summary>
        [FromDb("FileSize")]
        public int FileSize
        {
            get
            {
                return (this._FileSize);
            }

            set
            {
                _FileSize = value;
            }
        }







        /// <summary>
        /// 上传时间
        /// </summary>
        private DateTime _UpTime = DateTime.MinValue;


        ///<summary>
        /// 上传时间
        ///</summary>
        [FromDb("UpTime")]
        public DateTime UpTime
        {
            get
            {
                return (this._UpTime);
            }

            set
            {
                _UpTime = value;
            }
        }







        /// <summary>
        /// 是否删除
        /// </summary>
        private int _IsDel = -1;


        ///<summary>
        /// 是否删除
        ///</summary>
        [FromDb("IsDel")]
        public int __IsDel
        {
            get
            {
                return (this._IsDel);
            }
            set
            {
                _IsDel = value;
            }
        }

        public yq.Enums.BooleanType IsDel
        {
            get
            {
                return (yq.Enums.BooleanType)_IsDel;
            }

            set
            {
                _IsDel = value.GetHashCode();
            }
        }







        /// <summary>
        /// Version
        /// </summary>
        private String _Version = "";


        ///<summary>
        /// Version
        ///</summary>
        [FromDb("Version")]
        public String Version
        {
            get
            {
                return (this._Version);
            }

            set
            {
                _Version = value;
            }
        }



        ///<summary>
        /// 辅助验证类
        /// </summary>
        [Bind]
        public class SysFileValidaTion
        {

            /// <summary>
            /// 文件ID
            /// </summary>
            [Display(Name = "文件ID")]
            [Required]
            [StringLength(36)]
            public String FileId
            { get; set; }


            /// <summary>
            /// 服务ID
            /// </summary>
            [Display(Name = "服务ID")]
            [Required]
            [StringLength(36)]
            public String Sid
            { get; set; }


            /// <summary>
            /// 文件夹ID
            /// </summary>
            [Display(Name = "文件夹ID")]
            [Required]
            [StringLength(36)]
            public String FolderId
            { get; set; }


            /// <summary>
            /// 文件名称
            /// </summary>
            [Display(Name = "文件名称")]
            [Required]
            [StringLength(100)]
            public String FileName
            { get; set; }


            /// <summary>
            /// 文件扩展名
            /// </summary>
            [Display(Name = "文件扩展名")]
            [Required]
            [StringLength(10)]
            public String Extension
            { get; set; }


            /// <summary>
            /// 文件大小
            /// </summary>
            [Display(Name = "文件大小")]
            [Required]
            [RegularExpression(RegularExpressionString.Int, ErrorMessage = "必须输入数字")]

            public int FileSize
            { get; set; }


            /// <summary>
            /// 上传时间
            /// </summary>
            [Display(Name = "上传时间")]
            [Required]

            public DateTime UpTime
            { get; set; }


            /// <summary>
            /// 是否删除
            /// </summary>
            [Display(Name = "是否删除")]
            [Required]
            [RegularExpression(RegularExpressionString.Int, ErrorMessage = "必须输入数字")]

            public yq.Enums.BooleanType IsDel
            { get; set; }

        }
    }
}